Rename (computing)
   HOME

TheInfoList



OR:

In computing, rename refers to the altering of a name of a file. This can be done manually by using a shell command such as ren or mv, or by using
batch renaming Batch renaming is a form of batch processing used to rename multiple computer files and folders in an automated fashion, in order to save time and reduce the amount of work involved. Some sort of software is required to do this. Such software can b ...
software that can automate the renaming process.


Implementations

The
C standard library The C standard library or libc is the standard library for the C programming language, as specified in the ISO C standard.ISO/IEC (2018). '' ISO/IEC 9899:2018(E): Programming Languages - C ยง7'' Starting from the original ANSI C standard, it wa ...
provides a function called ''rename'' which does this action. In
POSIX The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines both the system- and user-level application programming interf ...
, which is extended from the C standard, the ''rename'' function will fail if the old and new names are on different mounted
file system In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
s. In SQL, renames are performed by using the CHANGE specification in ALTER TABLE statements.


Atomic rename

In
POSIX The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines both the system- and user-level application programming interf ...
, a successful call to ''rename'' is guaranteed to have been atomic from the point of view of the current host (i.e., another program would only see the file with the old name or the file with the new name, not both or neither of them). This aspect is often used during a file save operation to avoid any possibility of the file contents being lost if the save operation is interrupted. The ''rename'' function from the C library in
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
does not implement the POSIX atomic behaviour; instead it fails if the destination file already exists. However, other calls in the
Windows API The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations th ...
do implement the atomic behaviour.


References

{{Computing-stub Computing terminology